---
title: PDF Reader
---

The **PDF Reader** processes PDF files synchronously and converts them into documents that can be used with Agno's knowledge system.

## Code

```python examples/concepts/knowledge/readers/pdf_reader_sync.py
from agno.agent import Agent
from agno.knowledge.knowledge import Knowledge
from agno.knowledge.reader.pdf_reader import PDFReader
from agno.vectordb.pgvector import PgVector

db_url = "postgresql+psycopg://ai:ai@localhost:5532/ai"

# Create a knowledge base with PDF documents
knowledge = Knowledge(
    vector_db=PgVector(
        table_name="pdf_documents",
        db_url=db_url,
    )
)

# Add PDF content synchronously
knowledge.add_content(
    path="cookbook/knowledge/testing_resources/cv_1.pdf",
    reader=PDFReader(),
)

# Create an agent with the knowledge base
agent = Agent(
    knowledge=knowledge,
    search_knowledge=True,
)

# Query the knowledge base
agent.print_response(
    "What skills does an applicant require to apply for the Software Engineer position?",
    markdown=True,
)
```

## Usage

<Steps>
  <Snippet file="create-venv-step.mdx" />

  <Step title="Install libraries">
    ```bash
    pip install -U pypdf sqlalchemy psycopg pgvector agno openai
    ```
  </Step>

  <Step title="Set environment variables">
    ```bash
    export OPENAI_API_KEY=xxx
    ```
  </Step>

  <Snippet file="run-pgvector-step.mdx" />

  <Step title="Run Agent">
    <CodeGroup>
    ```bash Mac
    python examples/concepts/knowledge/readers/pdf_reader_sync.py
    ```

    ```bash Windows
    python examples/concepts/knowledge/readers/pdf_reader_sync.py
    ```
    </CodeGroup>
  </Step>
</Steps>

## Params

<Snippet file="pdf-reader-reference.mdx" />